<template>
    <!-- 标题区域 -->
    <van-nav-bar title="分类" fixed></van-nav-bar>
    <div style="height: 45px;"></div>
    <!-- 渲染区域 -->
    <van-row>
        <van-col span="6">
            <van-sidebar v-model="active">
                <van-sidebar-item v-for="item in ClaApiData" :title="item.cat_name" />
            </van-sidebar>
        </van-col>
        <van-col span="18">
            <div v-for="item in ClaApiData[active]?.children">
                <h4>{{ item.cat_name }}</h4>
                <router-link :to="{name:'goods',params:{query:item.cat_name}}">
                    <!-- 宫格 -->
                    <van-grid :column-num="4">
                        <van-grid-item v-for="items in item.children" :icon="items.cat_icon" :text="items.cat_name" />
                    </van-grid>
                </router-link>

            </div>
        </van-col>
    </van-row>
</template>

<script setup>
import { ref } from 'vue'
import { ClaApi } from '@/api/api'
let ClaApiData = ref([])
ClaApi().then(res => {
    console.log('分类数据', res)
    ClaApiData.value = res.data.message
})
const active = ref(0);
</script>

<style lang="scss" scoped></style>